package com.wythe.mall.adapter;

import android.content.Context;
import android.support.v7.widget.AppCompatEditText;
import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.LinearLayoutCompat;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;

import com.wythe.mall.R;

import java.util.ArrayList;

import top.yokey.base.bean.StoreBuyBean;

/**
 * 适配器
 *
 * @author MapleStory
 * @ qq 1002285057
 * @ project https://gitee.com/MapStory/Shopwt-Android
 */

public class StoreBuyListAdapter extends RecyclerView.Adapter<StoreBuyListAdapter.ViewHolder> {

    private final ArrayList<StoreBuyBean> arrayList;
    private Context context;

    public StoreBuyListAdapter(Context context, ArrayList<StoreBuyBean> arrayList) {
        this.context = context;
        this.arrayList = arrayList;

    }

    @Override
    public int getItemCount() {

        return 2;

    }

    @Override
    public void onBindViewHolder(final ViewHolder holder, int position) {

        final int positionInt = position;
//        final StoreBuyBean bean = arrayList.get(position);
//        final GoodsBuyListAdapter goodsBuyListAdapter;
//
//        goodsBuyListAdapter = new GoodsBuyListAdapter(null);
//        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context);
//        linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
//        holder.mainRecyclerView.setLayoutManager(linearLayoutManager);//设置布局管理器
//        holder.mainRecyclerView.setAdapter(goodsBuyListAdapter);
//        holder.voucherLineView.setVisibility(View.GONE);
//        holder.voucherRelativeLayout.setVisibility(View.GONE);

    }

    @Override
    public ViewHolder onCreateViewHolder(ViewGroup group, int viewType) {
        View view = LayoutInflater.from(group.getContext()).inflate(R.layout.item_list_store_buy, group, false);
        return new ViewHolder(view);
    }

    class ViewHolder extends RecyclerView.ViewHolder {

        private AppCompatTextView storeNameTextView;
        private View mansongLineView;
        private LinearLayoutCompat manSongLinearLayout;
        private AppCompatTextView manSongDescTextView;
        private AppCompatImageView manSongGoodsImageView;
        private RecyclerView mainRecyclerView;
        private View voucherLineView;
        private RelativeLayout voucherRelativeLayout;
        private AppCompatTextView voucherMoneyTextView;
        private AppCompatTextView logisticsMoneyTextView;
        private AppCompatTextView totalMoneyTextView;
        private AppCompatEditText messageEditText;

        private ViewHolder(View view) {
            super(view);
            storeNameTextView = view.findViewById(R.id.storeNameTextView);
            mansongLineView = view.findViewById(R.id.mansongLineView);
            manSongLinearLayout = view.findViewById(R.id.manSongLinearLayout);
            manSongDescTextView = view.findViewById(R.id.manSongDescTextView);

            manSongGoodsImageView = view.findViewById(R.id.manSongGoodsImageView);
            mainRecyclerView = view.findViewById(R.id.mainRecyclerView);

            voucherLineView = view.findViewById(R.id.voucherLineView);
            voucherRelativeLayout = view.findViewById(R.id.voucherRelativeLayout);

            voucherMoneyTextView = view.findViewById(R.id.voucherMoneyTextView);
            logisticsMoneyTextView = view.findViewById(R.id.logisticsMoneyTextView);
            totalMoneyTextView = view.findViewById(R.id.totalMoneyTextView);
            messageEditText = view.findViewById(R.id.messageEditText);

        }

    }

}
